import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import hi1 from '@/components/hi1'
// import h2 from '@/components/hi2'
import params from '@/components/params'
import error from '@/components/error'

Vue.use(Router)
export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    }, {
      path: '/params/:newsId/:newsTitle',
      component: params,
     /* beforeEnter: (to, form, next) => {
        console.log('to',to);
        console.log('form',form);
        console.log('next',next);
        next(true)
      }*/
    }, {
      path: '/goHome',
      redirect: '/'
    }, {
      path: '/goParams/:newsId/:newsTitle',
      redirect: '/params/:newsId/:newsTitle'
    }, {
      path: '/hi1',
      component: hi1,
      alias: '/theAlias'
    }, {
      path: '*',
      component: error,
    }
  ]
})
